/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package VO;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author Julian
 */
@Entity
@Table(name = "clickdia")
@NamedQueries({
    @NamedQuery(name = "Clickdia.findAll", query = "SELECT c FROM Clickdia c"),
    @NamedQuery(name = "Clickdia.findByIdEmpresa", query = "SELECT c FROM Clickdia c WHERE c.clickdiaPK.idEmpresa = :idEmpresa"),
    @NamedQuery(name = "Clickdia.findByFecha", query = "SELECT c FROM Clickdia c WHERE c.clickdiaPK.fecha = :fecha"),
    @NamedQuery(name = "Clickdia.findByClick", query = "SELECT c FROM Clickdia c WHERE c.click = :click")})
public class Clickdia implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected ClickdiaPK clickdiaPK;
    @Basic(optional = false)
    @Column(name = "Click")
    private int click;
    @JoinColumn(name = "idEmpresa", referencedColumnName = "idEmpresas", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Empresas empresas;

    public Clickdia() {
    }

    public Clickdia(ClickdiaPK clickdiaPK) {
        this.clickdiaPK = clickdiaPK;
    }

    public Clickdia(ClickdiaPK clickdiaPK, int click) {
        this.clickdiaPK = clickdiaPK;
        this.click = click;
    }

    public Clickdia(String idEmpresa, Date fecha) {
        this.clickdiaPK = new ClickdiaPK(idEmpresa, fecha);
    }

    public ClickdiaPK getClickdiaPK() {
        return clickdiaPK;
    }

    public void setClickdiaPK(ClickdiaPK clickdiaPK) {
        this.clickdiaPK = clickdiaPK;
    }

    public int getClick() {
        return click;
    }

    public void setClick(int click) {
        this.click = click;
    }

    public Empresas getEmpresas() {
        return empresas;
    }

    public void setEmpresas(Empresas empresas) {
        this.empresas = empresas;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (clickdiaPK != null ? clickdiaPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Clickdia)) {
            return false;
        }
        Clickdia other = (Clickdia) object;
        if ((this.clickdiaPK == null && other.clickdiaPK != null) || (this.clickdiaPK != null && !this.clickdiaPK.equals(other.clickdiaPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "VO.Clickdia[clickdiaPK=" + clickdiaPK + "]";
    }

}
